<template>
  <div v-for="item of dbServers" class="content">
    <h3>{{ item.name }}</h3>
    <db-server :dbIndex="item.dbIndex" :dbType="item.type" />
  </div>
</template>

<script setup>
  import { ref, inject, onMounted } from 'vue';
  import dbServer from '~/views/db/components/ServerInfo.vue';

  const http = inject('$http');
  const dbServers = ref([]);

  onMounted(() => {
    http.get('/api/db/servers').then(res => {
      dbServers.value = res;
    });
  });
</script>

<style lang="less" scoped>
  .content {
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #fff;
    border-radius: 5px;

    &:not(:first-of-type) {
      margin-top: 6px;
    }

    > h3 {
      margin: 0;
      background: #fff;
      padding: 10px 10px;
      font-size: 14px;
    }
  }
</style>
